package leetcode.interview;

import java.util.Arrays;

/**
 * ClassName: $02_CheckPermutation
 * Description:
 * date: 2021-09-19 17:51
 *
 * @author liyifan
 */
public class $02_CheckPermutation {
    public boolean CheckPermutation(String s1, String s2) {
        if (s1.length() != s2.length())
            return false;
        char[] arr1 = s1.toCharArray();
        char[] arr2 = s2.toCharArray();

        Arrays.sort(arr1);
        Arrays.sort(arr2);
        for (int i = 0;i < arr1.length; i++) {
            if (arr1[i] == arr2[i])
                continue;
            return false;
        }
        return true;
    }
}
